# To change this template, choose Tools | Templates
# and open the template in the editor.
require 'word'
require 'excel'
require 'powerpoint'
require 'text'

class WorkFactory
  def initialize
  end
  def self.create(work_name, file_name)
    ext = file_name.split(".")[1]
    return Text.new(work_name) if ext == "txt"
    return Word.new(work_name) if ext == "doc"
    return Excel.new(work_name) if ext == "xls"
    return Powerpoint.new(work_name) if ext == "ppt"
  end
end
